home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- global proc string mayaHardwareGetCommonGlobalValue(
- string $global)
- {
- //
- // Description:
- // This procedure is called when the current renderer has changed from the
- // Maya Hardware renderer to something else.
- // This procedure returns the value of the common global specified by
- // $global.
- // For a complete list of valid values for the $global argument, and to
- // see how this procedure is used, see copyCommonRenderGlobals.mel.
- //
- // Returns:
- // The value of the specified common global, as a string.
- //
-
- string $value;
-
- switch ($global)
- {
- case "animation":
- $value = `getAttr defaultRenderGlobals.animation`;
- break;
- case "startFrame":
- $value = `getAttr hardwareRenderGlobals.startFrame`;
- break;
- case "endFrame":
- $value = `getAttr hardwareRenderGlobals.endFrame`;
- break;
- case "byFrame":
- $value = `getAttr hardwareRenderGlobals.byFrame`;
- break;
- case "renderableObjects":
- global string $hardwareRenderSelectedFlag;
- if ($hardwareRenderSelectedFlag == "-renderSelected")
- {
- $value = "selected";
- }
- else
- {
- $value = "all";
- }
- break;
- case "useCustomExtension":
- $value = `getAttr hardwareRenderGlobals.useCustomExtension`;
- break;
- case "customExtension":
- $value = `getAttr hardwareRenderGlobals.customExtension`;
- break;
- case "renumberFrameUsing":
- $value = `getAttr hardwareRenderGlobals.modifyExtension`;
- break;
- case "renumberStartFrame":
- $value = `getAttr hardwareRenderGlobals.startExtension`;
- break;
- case "renumberByFrame":
- $value = `getAttr hardwareRenderGlobals.byExtension`;
- break;
- case "width":
- $value = `getAttr hardwareRenderGlobals.resolutionX`;
- break;
- case "height":
- $value = `getAttr hardwareRenderGlobals.resolutionY`;
- break;
- case "deviceAspectRatio":
- // HW does not store de device ratio. But we need to return
- // the value so that other renderer can update it.
- float $ratio = `getAttr hardwareRenderGlobals.pixelAspectRatio`;
- float $valueX = `getAttr hardwareRenderGlobals.resolutionX`;
- float $valueY = `getAttr hardwareRenderGlobals.resolutionY`;
- $value = ($ratio * $valueX) / $valueY;
- break;
- case "pixelAspectRatio":
- $value = `getAttr hardwareRenderGlobals.pixelAspectRatio`;
- break;
- case "enableDefaultLight":
- $value = `getAttr hardwareRenderGlobals.enableDefaultLight`;
- break;
- case "preRenderMel":
- $value = `getAttr hardwareRenderGlobals.preRenderMel`;
- break;
- case "postRenderMel":
- $value = `getAttr hardwareRenderGlobals.postRenderMel`;
- break;
- default:
- warning(
- "mayaHardwareGetCommonGlobalValue() was asked for the value "
- + "of a global ("
- + $global
- + ") it does not support. "
- + "Modify mayaHardwareHasCommonGlobal() to fix the problem\n");
- break;
- }
-
- return $value;
- }
-